const HtmlPlugin = require('html-webpack-plugin');

const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve( __dirname, 'dist' ),
    publicPath: "/assets/",
    filename: 'wechat-menu-editor.js'
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        include: [
          path.resolve( __dirname, 'src' )
        ],
        exclude: /node_modules/,
        loader: 'babel-loader'
      },
      {
        test: /\.css$/,
        loader: 'style-loader!css-loader?modules'
      },
      {
        test: /\.json$/,
        loader: 'json-loader'
      },
      { test: /\.png$/, loader: "url-loader?mimetype=image/png" }
    ]
  },
  plugins: [
    new HtmlPlugin({
      template: __dirname + '/src/index.template.html'
    })
  ],
  devtool: 'source-map',
  devServer: {
    contentBase: "./dist",
    colors: true,
    historyApiFallback: true,
    inline: true
  }
};
